1. /* sfffsdiv.cpp by K.Tsuru */
  2. // function ID = 715 DRADIX
  3. /***********************************
  4. SFraction class
  5. It devides "x" by a short value "n" i.e. multiplys by "1/n".
  6. x.num 1 x.num
  7. ------- * --- = ----------
  8. x.den n n*x.den
  9. ************************************/
  10. #ifndef SN_H
  11. #include "sn.h"
  12. #endif
  13. SFraction FsDiv(const SFraction& x, ulong n){
  14. if(n == 1uL) return x;
  15. if(n == 0) x.num.SetError(x.num.DIVIDED_BY_ZERO,"FsDiv", 715);
  16. SFraction r(x);
  17. if(n <= r.den.SlOpMaxValue()) r.den = LsMult(r.den, n);
  18. else r.den *= n;
  19. r.reduceDone = false;
  20. #if REDUCE_SIZE != 0
  21. r.reduce(false);
  22. #else
  23. r.reduce();
  24. #endif
  25. return r;
  26. }

sfffsdiv.cpp : last modifiled at 2017/10/23 11:09:52(688 bytes)
created at 2015/12/22 16:07:29
The creation time of this html file is 2017/10/23 11:26:54 (Mon Oct 23 11:26:54 2017).